#include <boost/test/unit_test.hpp>

#include <phalanx/type_traits/builtin_traits.hpp.cu>

#define check( type, value ) \
  BOOST_REQUIRE(( value == phalanx::vector_type_traits< type >::size() ))

#define dup_check( type, value ) \
  check( type, value ); \
  check( unsigned type, value )

#define check_v( type ) \
  check( type ## 1, 1 ); \
  check( type ## 2, 2 ); \
  check( type ## 3, 3 ); \
  check( type ## 4, 4 )

#define dup_check_v( type ) \
  check_v( type ); \
  check_v( u ## type )

namespace ns_builtin_traits
{

BOOST_AUTO_TEST_CASE( integer )
{
    dup_check_v( char );
    dup_check_v( short );
    dup_check_v( int );
    dup_check_v( long );
    dup_check_v( longlong );

    dup_check( char, 1 );
    dup_check( short, 1 );
    dup_check( int, 1 );
    dup_check( long, 1 );
}

BOOST_AUTO_TEST_CASE( floating_point )
{
    check_v( float );
    check_v( double );

    check( float, 1 );
    check( double, 1 );
}

BOOST_AUTO_TEST_CASE( others )
{
    check( dim3, 3 );

    check( std::size_t, 1 );
    check( std::ptrdiff_t, 1 );
}

} // namespace ns_builtin_traits

